package org.clockworkmages.games.anno1186.generator.sets;

import org.clockworkmages.games.anno1186.GameTimeService;
import org.clockworkmages.games.anno1186.dao.GameObjectsList;
import org.clockworkmages.games.anno1186.generator.GameObjectGenerator;
import org.clockworkmages.games.anno1186.model.character.SkillConstants;
import org.clockworkmages.games.anno1186.model.character.StatConstants;
import org.clockworkmages.games.anno1186.model.option.GenericOption;
import org.clockworkmages.games.anno1186.model.situation.GenericSituation;
import org.clockworkmages.games.anno1186.scripting.tools.ScriptBuilder;
import org.clockworkmages.games.anno1186.scripting.tools.TextBuilder;

public class Palos
		extends GameObjectGenerator
//
		implements StatConstants, SkillConstants, TechnicalSituationConstants {

	public String getFileName() {
		return "palos";
	}

	@Override
	public GameObjectsList generate() {
		GameObjectsList gameObjects = new GameObjectsList();

		GenericOption option = new GenericOption();
		GenericSituation situation = new GenericSituation();

		situation = new GenericSituation();
		situation.setClearScreen(true);
		situation.setId("PALOS_TAVERN");
		situation.setText("You are in the Mermaid's Luck tavern in Palos .");
		gameObjects.getSituations().add(situation);

		option = new GenericOption();
		option.setLabel("Innkeeper");
		option.setIcon("talk");
		option.setGoToSituation("PALOS_INNKEEPER");
		situation.getOptions().add(option);

		option = new GenericOption();
		option.setLabel("Go to your room (Sleep until morning)");
		option.setIcon("sleep");
		option.setTimePassed(8 * GameTimeService.HOUR);
		option.setCondition("!"
				+ ScriptBuilder.UTIL().isDay().and().plot()
						.is("PALOS_JOINED_THE_CREW"));
		option.setTextAfter("You go to your room and fall asleep almost immediately. When you awake, it's early morning.");
		situation.getOptions().add(option);

		option = new GenericOption();
		option.setLabel("Go out");
		option.setIcon("out");
		option.setTimePassed(20 * GameTimeService.SECOND);
		option.setGoToSituation("PALOS_MARKET");
		// option.setCondition("!" + ScriptBuilder.UTIL().isDay());
		situation.getOptions().add(option);

		// option = new GenericOption();
		// option.setOr(true);
		// option.setLabel("Go out");
		// option.setIcon("out");
		// option.setTimePassed(20 * GameTimeService.SECOND);
		// option.setGoToSituation("PALOS_MARKET_DAY");
		// situation.getOptions().add(option);

		situation = new GenericSituation();
		situation.setClearScreen(true);
		situation.setId("PALOS_MARKET");
		situation
				.setText("You are in the dockside market in western part of Palos.\n"
						+ TextBuilder
								.NEW()
								.iff()
								.util()
								.isDay()
								.then("It's a warm autumn day and there's a lot of people around you, buying and selling fish as well as exotic goods imported from faraway lands")
								.elsee("It is night already and there's not a sould to be seen here at this late hour.")
								.asText());
		gameObjects.getSituations().add(situation);

		option = new GenericOption();
		option.setLabel("Palos docks");
		option.setIcon("west");
		option.setTimePassed(20 * GameTimeService.SECOND);
		option.setGoToSituation("PALOS_DOCKS");
		situation.getOptions().add(option);

		option = new GenericOption();
		option.setLabel("Dark alley");
		option.setIcon("south");
		option.setTimePassed(20 * GameTimeService.SECOND);
		option.setGoToSituation("PALOS_ALLEY");
		situation.getOptions().add(option);

		option = new GenericOption();
		option.setLabel("Mermaid's Luck tavern");
		option.setIcon("in");
		option.setTimePassed(20 * GameTimeService.SECOND);
		option.setGoToSituation("PALOS_TAVERN");
		situation.getOptions().add(option);

		situation = new GenericSituation();
		situation.setClearScreen(true);
		situation.setId("PALOS_ALLEY");
		situation
				.setText("You are in the dockside market in western part of Palos.\n"
						+ TextBuilder
								.NEW()
								.iff()
								.util()
								.isDay()
								.then("It's a warm autumn day and there's a lot of people around you, buying and selling fish as well as exotic goods imported from faraway lands")
								.elsee("It is night already and there's not a sould to be seen here at this late hour.")
								.asText());
		gameObjects.getSituations().add(situation);

		option = new GenericOption();
		option.setLabel("Palos market");
		option.setIcon("north");
		option.setTimePassed(20 * GameTimeService.SECOND);
		option.setGoToSituation("PALOS_MARKET");
		situation.getOptions().add(option);

		situation = new GenericSituation();
		situation.setClearScreen(true);
		situation.setId("PALOS_DOCKS");
		situation
				.setText("You are in the dockside market in western part of Palos.\n"
						+ TextBuilder
								.NEW()
								.iff()
								.util()
								.isDay()
								.then("It's a warm autumn day and there's a lot of people around you, buying and selling fish as well as exotic goods imported from faraway lands")
								.elsee("It is night already and there's not a sould to be seen here at this late hour.")
								.asText());
		gameObjects.getSituations().add(situation);

		option = new GenericOption();
		option.setLabel("Palos market");
		option.setIcon("east");
		option.setTimePassed(20 * GameTimeService.SECOND);
		option.setGoToSituation("PALOS_MARKET");
		situation.getOptions().add(option);
		//

		// TODO
		// talking with Juan de la cosa:
		// -the expedition
		// --crew
		// --Cristobal Colon
		// --duration of the journey
		// -pay
		// --(Speech) pay in advance
		// -(pickpocket)
		// -Agree!
		//
		// -Tavern's common room
		// --innkeeper
		// --go to your room (Sleep until morning)
		// --cheap whore
		// -Dockside market of Palos
		// -Dark alley
		// --Shady character
		// ---Fight! (reputation>5)
		// ---Trade (reputation<5): brass knuckles, sharp dagger, wolfsbane
		// extract

		return gameObjects;
	}
}
